// JavaScript Document


function filterConfig(OS,browser,version) {
		switch(browser) {
				case "explorer":
						if(OS == "mac") adjustMacIE(version);
						break;
						
				case "safari":
						//do safari;
						break;
						
				/*case "firefox":
						if(OS == "mac") {
								adjustMacFirefox();
							}
						else {
								adjustWinFirefox();
							}
						break;*/						
				case "netscape":
						//do nothing
						break;			
				default:
						//do other browser		
			}		
	}

function adjustMacIE(version) {
		if((version > 4) && (version < 6)) {
				document.write("<link href=\"./common/style/mac.css\" rel=\"stylesheet\" type=\"text/css\" />");
			}
	}

var agent=navigator.userAgent.toLowerCase();
var appVer = navigator.appVersion.toLowerCase();
var is_minor = parseFloat(appVer);
var is_major = parseInt(is_minor);



var x_browser;
var x_os;
var x_version;

var ver1; //index used to extract version numbers from strings
var ver2; //end position used to extract version numbers from strings

if(agent.indexOf("mac") != -1) { //mac OS
		x_os = "mac";
		if(agent.indexOf("safari") != -1) {
				x_browser = "safari";				
			}
		if(agent.indexOf("firefox") != -1) {
				x_browser = "firefox";
			}
		if(agent.indexOf("msie") != -1) {
				x_browser = "explorer";
				ver1 = appVer.indexOf("msie ") +5;
				ver2 = appVer.charAt("; m") -1; // move the index to the left by one to uninclude the semicolon
				x_version = parseFloat(appVer.substr(ver1,ver2));
			}		
	}

if(agent.indexOf("win") != -1) {//windows
		x_os = "win";
		if(agent.indexOf("firefox") != -1) {
				x_browser = "firefox";				
				x_version = parseFloat(navigator.vendorSub); 
			}
		if(agent.indexOf("msie") != -1) {
				x_browser = "explorer";
				ver1 = appVer.indexOf("msie ") + 5; // 5 is the length of the string, "msie "
				ver2 = appVer.charAt("; w") -1; // move the index to the left by one to uninclude the semicolon
				x_version = parseFloat(appVer.substr(ver1,ver2));
			}
		if(agent.indexOf("netscape") != -1) {
				x_browser ="netscape";
				x_version = (navigator.vendorSub);
			}		
	}
	
filterConfig(x_os,x_browser,x_version);